{{ "<!-- sidebar -->" | safeHTML }}
<aside class="col-lg-4 order-1 order-lg-2">
  {{ "<!-- tags -->" | safeHTML }}
  <div class="bg-white px-4 py-5 box-shadow mb-5 word-cloud">
    <h4 class="mb-4">{{ i18n "tags" }}</h4>
    {{ if not (eq (len $.Site.Taxonomies.categories) 0) }}
      {{ $fontUnit := "rem" }}
      {{ $largestFontSize := 2.0 }}
      {{ $smallestFontSize := 1.0 }}
      {{ $fontSpread := sub $largestFontSize $smallestFontSize }}
      {{ $max := add (len (index $.Site.Taxonomies.tags.ByCount 0).Pages) 1 }}
      {{ $min := 1 }}
      {{ $spread := sub $max $min }}
      {{ $fontStep := div $fontSpread $spread }}
      {{ $tags := $.Site.Taxonomies.tags.Alphabetical }}
      {{ $tags := where $tags "Count" ">=" $min }}
      {{ $tags := where $tags "Term" "not in" (slice "hugo" "tags" "rss" "old") }}
      <div id="tag-cloud" style="padding: 5px 15px">
      {{ range $key, $tag := $tags }}
        {{ if $tag.Term }}
          {{ $tagURL := printf "tags/%s" $tag.Term | relURL }}
          {{ $currentFontSize := (add $smallestFontSize (mul (sub $tag.Count $min) $fontStep) ) }}
          {{ if ne $key 0}}&middot;{{ end }}
          <a href="{{ $tagURL }}" style="font-size:{{$currentFontSize}}{{$fontUnit}}">{{ $tag.Term }}</a>
        {{ end }}
      {{ end }}
      </div>
    {{ end }}
  </div>

  {{ "<!-- profile -->" | safeHTML }}
  {{- if .Params.Profile }}
  <div class="bg-pink px-4 py-5 box-shadow mb-5 avatar-content">
    <div class="avatar">
      {{- if .Params.avatar }}
      <div class="mx-auto avatar-wrp">
        <img class="rounded-circle avatar-img" src="{{ .Params.Avatar }}">
      </div>
      {{- end }}
      <p class="avatar-name">
        <strong class="text-dark ">{{ .Params.Author | markdownify }}</strong> 
      </p>
      <p>{{ .Params.Profile }}</p>
    </div>
  </div>
  {{- end }}
  {{ "<!-- toc -->" | safeHTML }}
  {{ if gt .WordCount 400 }}
  <div class="bg-white px-4 py-5 box-shadow mb-5 sticky-top">
    <h4 class="mb-4">{{ i18n "toc" }}</h4>
    {{ .TableOfContents }}
  </div>
  {{- end }}

</aside>
{{ "<!-- /sidebar -->" | safeHTML }}
